Remove the parenthesis area

pattern = r” ?([^)]+)”

Remove the parenthesis area in a string.
Sample data :
[“example (.com)”, “w3resource”, “github (.com)”, “stackoverflow (.com)”]
Expected output:
example
w3resource
github
stackoverflow
import re

items = ["example (.com)", "w3resource", "github (.com)", "stackoverflow (.com)"]

pattern = r" ?\([^)]+\)"

for item in items:
    print(re.sub(pattern, "", item))

Output:

example
w3resource
github
stackoverflow